import java.util.ArrayList;

public class Hand {
	ArrayList<String> hand = new ArrayList<String>();

	public Hand(Deck deck) {
		for (int i = 0; i < 5; i++) {
			drawCard(deck);
		}
	}

	public void drawCard(Deck deck) {
		int random = (int) (Math.random() * deck.getDeck().size());
		hand.add(String.valueOf(deck.getDeck().get(random).getSuit())
				+ String.valueOf(deck.getDeck().get(random).getValue()));
		deck.getDeck().remove(random);
	}

	public ArrayList<String> getHand() {
		return hand;
	}

	public void displayHand(int x) {
		System.out.print("Hand[" + x + "]: ");
		for (int i = 0; i < hand.size(); i++) {
			System.out.print(hand.get(i) + " ");
		}
		System.out.print("Score: " + this.getScore());
		System.out.print("\n");
	}

	public int getScore() {
		int score = 0;
		for (int i = 0; i < hand.size(); i++) {
			score += Integer.parseInt(hand.get(i).substring(1));
		}
		return score;
	}

	public void passCards(int first, int second, Hand[] hands, String[] cards,
			int turn) {
		hand.remove(first);
		hand.remove(second);
		if (turn == 3){
			turn = 0;
		}
		hands[turn + 1].getHand().add(cards[0].toUpperCase());
		hands[turn + 1].getHand().add(cards[1].toUpperCase());
	}
}
